\hypertarget{group___interrupts}{
\section{Interrupts}
\label{group___interrupts}\index{Interrupts@{Interrupts}}
}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \hyperlink{group___interrupts_ga9804d238d82a0d72a73fd868f42ef29a}{install\_\-asm\_\-irq\_\-handler} (int irq, void($\ast$irq\_\-func)(void), \_\-go32\_\-dpmi\_\-seginfo $\ast$old\_\-irq)
\item 
int \hyperlink{group___interrupts_gad55f4b2b6ce5cc38757c82a50648d60f}{install\_\-c\_\-irq\_\-handler} (int irq, void($\ast$irq\_\-func)(void), \_\-go32\_\-dpmi\_\-seginfo $\ast$old\_\-irq, \_\-go32\_\-dpmi\_\-seginfo $\ast$new\_\-irq)
\item 
void \hyperlink{group___interrupts_ga1bff8e5131acdf8a4e6309c058f8652d}{reinstall\_\-asm\_\-irq\_\-handler} (int irq, \_\-go32\_\-dpmi\_\-seginfo $\ast$old\_\-irq)
\item 
void \hyperlink{group___interrupts_ga43db590e1a483eccc23d576891a67634}{reinstall\_\-c\_\-irq\_\-handler} (int irq, \_\-go32\_\-dpmi\_\-seginfo $\ast$old\_\-irq, \_\-go32\_\-dpmi\_\-seginfo $\ast$new\_\-irq)
\item 
int \hyperlink{group___interrupts_gad36bc1b286b003e91b38d00c60508ab4}{disable\_\-irq} (int irq)
\item 
void \hyperlink{group___interrupts_ga71c80934bf15a4691e5a360fe0283227}{enable\_\-irq} (int irq)
\end{DoxyCompactItemize}
\subsection*{PIC registers address}
\label{_amgrp0e27873a06f342c0540253e4288ecbd2}
 \begin{DoxyCompactItemize}
\item 
\hypertarget{group___interrupts_ga04c9015da7e7ea45f3b80793809e2d7b}{
\#define \hyperlink{group___interrupts_ga04c9015da7e7ea45f3b80793809e2d7b}{EOI}~0x20}
\label{group___interrupts_ga04c9015da7e7ea45f3b80793809e2d7b}

\begin{DoxyCompactList}\small\item\em End Of Interrupt Command $\ast$/. \item\end{DoxyCompactList}\item 
\hypertarget{group___interrupts_ga4c4c538b4d0809530a26a7a6d4469259}{
\#define \hyperlink{group___interrupts_ga4c4c538b4d0809530a26a7a6d4469259}{PIC1\_\-CMD}~0x20}
\label{group___interrupts_ga4c4c538b4d0809530a26a7a6d4469259}

\begin{DoxyCompactList}\small\item\em PIC1 register address to send EOI $\ast$/. \item\end{DoxyCompactList}\item 
\hypertarget{group___interrupts_gae21e6e278037d30c9548e2fbb4308306}{
\#define \hyperlink{group___interrupts_gae21e6e278037d30c9548e2fbb4308306}{PIC2\_\-CMD}~0xA0}
\label{group___interrupts_gae21e6e278037d30c9548e2fbb4308306}

\begin{DoxyCompactList}\small\item\em PIC2 register address to send EOI $\ast$/. \item\end{DoxyCompactList}\item 
\hypertarget{group___interrupts_gaa3dff2c40de0e2e49169667cd532ff5d}{
\#define \hyperlink{group___interrupts_gaa3dff2c40de0e2e49169667cd532ff5d}{PIC1\_\-MASK}~0x21}
\label{group___interrupts_gaa3dff2c40de0e2e49169667cd532ff5d}

\begin{DoxyCompactList}\small\item\em PIC1 register address to read/write interrupt mask $\ast$/. \item\end{DoxyCompactList}\item 
\hypertarget{group___interrupts_ga7090b89c836f52633a21362b1a88d169}{
\#define \hyperlink{group___interrupts_ga7090b89c836f52633a21362b1a88d169}{PIC2\_\-MASK}~0xA1}
\label{group___interrupts_ga7090b89c836f52633a21362b1a88d169}

\begin{DoxyCompactList}\small\item\em PIC2 register address to read/write interrupt mask $\ast$/. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{PC Interrupts}
\label{_amgrpaf297be20b740ff6059735b0a32fbe91}
 \begin{DoxyCompactItemize}
\item 
\hypertarget{group___interrupts_ga1058a1aa8a9bd3d631bf530ce28f1966}{
\#define \hyperlink{group___interrupts_ga1058a1aa8a9bd3d631bf530ce28f1966}{T0\_\-IRQ}~0}
\label{group___interrupts_ga1058a1aa8a9bd3d631bf530ce28f1966}

\begin{DoxyCompactList}\small\item\em Timer 0. \item\end{DoxyCompactList}\item 
\hypertarget{group___interrupts_ga5c1072213ce8d8cd43628c4319ae0391}{
\#define \hyperlink{group___interrupts_ga5c1072213ce8d8cd43628c4319ae0391}{KBD\_\-IRQ}~1}
\label{group___interrupts_ga5c1072213ce8d8cd43628c4319ae0391}

\begin{DoxyCompactList}\small\item\em keyboard \item\end{DoxyCompactList}\item 
\hypertarget{group___interrupts_gab02d84052a299a0c207a8ea4c1a5636d}{
\#define \hyperlink{group___interrupts_gab02d84052a299a0c207a8ea4c1a5636d}{COM2\_\-IRQ}~3}
\label{group___interrupts_gab02d84052a299a0c207a8ea4c1a5636d}

\begin{DoxyCompactList}\small\item\em serial port 2 \item\end{DoxyCompactList}\item 
\hypertarget{group___interrupts_ga3685c78b9bd6dd0fa3861807e24a4e1b}{
\#define \hyperlink{group___interrupts_ga3685c78b9bd6dd0fa3861807e24a4e1b}{COM1\_\-IRQ}~4}
\label{group___interrupts_ga3685c78b9bd6dd0fa3861807e24a4e1b}

\begin{DoxyCompactList}\small\item\em serial port 1 \item\end{DoxyCompactList}\item 
\hypertarget{group___interrupts_gab798870fcb9115136a568cb32b23ef22}{
\#define \hyperlink{group___interrupts_gab798870fcb9115136a568cb32b23ef22}{FLP\_\-IRQ}~6}
\label{group___interrupts_gab798870fcb9115136a568cb32b23ef22}

\begin{DoxyCompactList}\small\item\em floppy \item\end{DoxyCompactList}\item 
\hypertarget{group___interrupts_gac07daf55b57faa9fc7a89dd958491b87}{
\#define \hyperlink{group___interrupts_gac07daf55b57faa9fc7a89dd958491b87}{LPT\_\-IRQ}~7}
\label{group___interrupts_gac07daf55b57faa9fc7a89dd958491b87}

\begin{DoxyCompactList}\small\item\em parallel port \item\end{DoxyCompactList}\item 
\hypertarget{group___interrupts_ga4e22feb6ffbc1cda32fadff5c740dc51}{
\#define \hyperlink{group___interrupts_ga4e22feb6ffbc1cda32fadff5c740dc51}{RTC\_\-IRQ}~8}
\label{group___interrupts_ga4e22feb6ffbc1cda32fadff5c740dc51}

\begin{DoxyCompactList}\small\item\em realtime clock \item\end{DoxyCompactList}\item 
\hypertarget{group___interrupts_ga85964cb90343bb1a029b1d1b4229f910}{
\#define \hyperlink{group___interrupts_ga85964cb90343bb1a029b1d1b4229f910}{MOUSE\_\-IRQ}~12}
\label{group___interrupts_ga85964cb90343bb1a029b1d1b4229f910}

\begin{DoxyCompactList}\small\item\em mouse \item\end{DoxyCompactList}\item 
\hypertarget{group___interrupts_ga2eb3855b2ebb572634476bec1295d416}{
\#define \hyperlink{group___interrupts_ga2eb3855b2ebb572634476bec1295d416}{FPU\_\-IRQ}~13}
\label{group___interrupts_ga2eb3855b2ebb572634476bec1295d416}

\begin{DoxyCompactList}\small\item\em Floating point. \item\end{DoxyCompactList}\item 
\hypertarget{group___interrupts_ga44d6af5d6634d33a4a73f7a8fa8ed0bf}{
\#define \hyperlink{group___interrupts_ga44d6af5d6634d33a4a73f7a8fa8ed0bf}{DISK1\_\-IRQ}~14}
\label{group___interrupts_ga44d6af5d6634d33a4a73f7a8fa8ed0bf}

\begin{DoxyCompactList}\small\item\em Hard disk controller 1. \item\end{DoxyCompactList}\item 
\hypertarget{group___interrupts_ga80379b15cee6a84e9eb0a2f74e266bf9}{
\#define \hyperlink{group___interrupts_ga80379b15cee6a84e9eb0a2f74e266bf9}{DISK2\_\-IRQ}~15}
\label{group___interrupts_ga80379b15cee6a84e9eb0a2f74e266bf9}

\begin{DoxyCompactList}\small\item\em Hard disk controller 2. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Some usefull definitions}
\label{_amgrp1aea66ee1b4a97fbdcdbefe71adebb34}
 \begin{DoxyCompactItemize}
\item 
\#define \hyperlink{group___interrupts_ga74447581a052899240d863b9ffa80752}{IRQ\_\-MASK\_\-BIT}(irq)~((irq) $<$ 8 ? 1 $<$$<$ (irq) : (1 $<$$<$ (irq)) $>$$>$ 8)
\item 
\#define \hyperlink{group___interrupts_ga56163aadc0579c92911b527ed9d11496}{IRQ\_\-VECTOR}(irq)~((irq) $<$ 8 ? (irq) + 0x08 : (irq) -\/ 8 + 0x70)
\end{DoxyCompactItemize}


\subsection{Detailed Description}
Interrupt related functions 

\subsection{Define Documentation}
\hypertarget{group___interrupts_ga74447581a052899240d863b9ffa80752}{
\index{Interrupts@{Interrupts}!IRQ\_\-MASK\_\-BIT@{IRQ\_\-MASK\_\-BIT}}
\index{IRQ\_\-MASK\_\-BIT@{IRQ\_\-MASK\_\-BIT}!Interrupts@{Interrupts}}
\subsubsection[{IRQ\_\-MASK\_\-BIT}]{\setlength{\rightskip}{0pt plus 5cm}\#define IRQ\_\-MASK\_\-BIT(irq)~((irq) $<$ 8 ? 1 $<$$<$ (irq) : (1 $<$$<$ (irq)) $>$$>$ 8)}}
\label{group___interrupts_ga74447581a052899240d863b9ffa80752}
Gives mask bit associated with a given irq. {\itshape Warning\/}, if irq $>$ 7 the result must be applied to PIC2 \hypertarget{group___interrupts_ga56163aadc0579c92911b527ed9d11496}{
\index{Interrupts@{Interrupts}!IRQ\_\-VECTOR@{IRQ\_\-VECTOR}}
\index{IRQ\_\-VECTOR@{IRQ\_\-VECTOR}!Interrupts@{Interrupts}}
\subsubsection[{IRQ\_\-VECTOR}]{\setlength{\rightskip}{0pt plus 5cm}\#define IRQ\_\-VECTOR(irq)~((irq) $<$ 8 ? (irq) + 0x08 : (irq) -\/ 8 + 0x70)}}
\label{group___interrupts_ga56163aadc0579c92911b527ed9d11496}
gives the vector associated with a given IRQ 

\subsection{Function Documentation}
\hypertarget{group___interrupts_gad36bc1b286b003e91b38d00c60508ab4}{
\index{Interrupts@{Interrupts}!disable\_\-irq@{disable\_\-irq}}
\index{disable\_\-irq@{disable\_\-irq}!Interrupts@{Interrupts}}
\subsubsection[{disable\_\-irq}]{\setlength{\rightskip}{0pt plus 5cm}int disable\_\-irq (int {\em irq})}}
\label{group___interrupts_gad36bc1b286b003e91b38d00c60508ab4}
Mask the bit corresponding to 'irq', disabling its interrupts. Returns the previous irq status The correct PIC is used. \hypertarget{group___interrupts_ga71c80934bf15a4691e5a360fe0283227}{
\index{Interrupts@{Interrupts}!enable\_\-irq@{enable\_\-irq}}
\index{enable\_\-irq@{enable\_\-irq}!Interrupts@{Interrupts}}
\subsubsection[{enable\_\-irq}]{\setlength{\rightskip}{0pt plus 5cm}void enable\_\-irq (int {\em irq})}}
\label{group___interrupts_ga71c80934bf15a4691e5a360fe0283227}
Unmask the bit corresponding to 'irq', enabling its interrupts. The correct PIC is used. \hypertarget{group___interrupts_ga9804d238d82a0d72a73fd868f42ef29a}{
\index{Interrupts@{Interrupts}!install\_\-asm\_\-irq\_\-handler@{install\_\-asm\_\-irq\_\-handler}}
\index{install\_\-asm\_\-irq\_\-handler@{install\_\-asm\_\-irq\_\-handler}!Interrupts@{Interrupts}}
\subsubsection[{install\_\-asm\_\-irq\_\-handler}]{\setlength{\rightskip}{0pt plus 5cm}int install\_\-asm\_\-irq\_\-handler (int {\em irq}, \/  void($\ast$)(void) {\em irq\_\-func}, \/  \_\-go32\_\-dpmi\_\-seginfo $\ast$ {\em old\_\-irq})}}
\label{group___interrupts_ga9804d238d82a0d72a73fd868f42ef29a}
Installs the ASM written function 'irq\_\-func' as the interrupt handler associated with interrupt 'irq', updating the 'old\_\-irq' structure with the current interrupt handler. Returns 0 on success or -\/1 on error, in which case the original interrupt handler remains installed.

See \hyperlink{group___interrupts_ga1bff8e5131acdf8a4e6309c058f8652d}{reinstall\_\-asm\_\-irq\_\-handler()} to reinstall the original handler. \hypertarget{group___interrupts_gad55f4b2b6ce5cc38757c82a50648d60f}{
\index{Interrupts@{Interrupts}!install\_\-c\_\-irq\_\-handler@{install\_\-c\_\-irq\_\-handler}}
\index{install\_\-c\_\-irq\_\-handler@{install\_\-c\_\-irq\_\-handler}!Interrupts@{Interrupts}}
\subsubsection[{install\_\-c\_\-irq\_\-handler}]{\setlength{\rightskip}{0pt plus 5cm}int install\_\-c\_\-irq\_\-handler (int {\em irq}, \/  void($\ast$)(void) {\em irq\_\-func}, \/  \_\-go32\_\-dpmi\_\-seginfo $\ast$ {\em old\_\-irq}, \/  \_\-go32\_\-dpmi\_\-seginfo $\ast$ {\em new\_\-vec})}}
\label{group___interrupts_gad55f4b2b6ce5cc38757c82a50648d60f}
Installs the C written 'irq\_\-func' interrupt handler at the interrupt handler associated with interrupt 'irq', updating the old\_\-irq structure with the current interrupt handler. Returns 0 on success or -\/1 on error, in which case the original interrupt handler remains installed.

See \hyperlink{group___interrupts_ga43db590e1a483eccc23d576891a67634}{reinstall\_\-c\_\-irq\_\-handler()} to reinstall the original handler. \hypertarget{group___interrupts_ga1bff8e5131acdf8a4e6309c058f8652d}{
\index{Interrupts@{Interrupts}!reinstall\_\-asm\_\-irq\_\-handler@{reinstall\_\-asm\_\-irq\_\-handler}}
\index{reinstall\_\-asm\_\-irq\_\-handler@{reinstall\_\-asm\_\-irq\_\-handler}!Interrupts@{Interrupts}}
\subsubsection[{reinstall\_\-asm\_\-irq\_\-handler}]{\setlength{\rightskip}{0pt plus 5cm}void reinstall\_\-asm\_\-irq\_\-handler (int {\em irq}, \/  \_\-go32\_\-dpmi\_\-seginfo $\ast$ {\em old\_\-irq})}}
\label{group___interrupts_ga1bff8e5131acdf8a4e6309c058f8652d}
Reinstalls the interrupt handler specified in 'old\_\-irq' for interrupt 'irq'. See \hyperlink{group___interrupts_ga9804d238d82a0d72a73fd868f42ef29a}{install\_\-asm\_\-irq\_\-handler()}. \hypertarget{group___interrupts_ga43db590e1a483eccc23d576891a67634}{
\index{Interrupts@{Interrupts}!reinstall\_\-c\_\-irq\_\-handler@{reinstall\_\-c\_\-irq\_\-handler}}
\index{reinstall\_\-c\_\-irq\_\-handler@{reinstall\_\-c\_\-irq\_\-handler}!Interrupts@{Interrupts}}
\subsubsection[{reinstall\_\-c\_\-irq\_\-handler}]{\setlength{\rightskip}{0pt plus 5cm}void reinstall\_\-c\_\-irq\_\-handler (int {\em irq}, \/  \_\-go32\_\-dpmi\_\-seginfo $\ast$ {\em old\_\-irq}, \/  \_\-go32\_\-dpmi\_\-seginfo $\ast$ {\em new\_\-irq})}}
\label{group___interrupts_ga43db590e1a483eccc23d576891a67634}
Reinstalls the interrupt handler specified in 'old\_\-irq' for interrupt 'irq'. See \hyperlink{group___interrupts_gad55f4b2b6ce5cc38757c82a50648d60f}{install\_\-c\_\-irq\_\-handler()}. 